package ru.gerunn.silent.common;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import ru.gerunn.silent.message.Message;


public class ConsoleReader implements Reader {

	private BufferedReader reader;

	public ConsoleReader() {
		this.setReader(new BufferedReader(new InputStreamReader(System.in)));
	}

	public BufferedReader getReader() {
		return reader;
	}

	public void setReader(BufferedReader reader) {
		this.reader = reader;
	}

	public Message read() {
		try {
			return new Message(this.getReader().readLine());
		} catch (IOException e) {
			e.printStackTrace();
		}

		return null;
	}

}
